import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/',
    name: 'Index',
    component: () => import('../views/Index.vue'),
    children: [
      {
        path: '/',
        name: 'Product',
        component: () => import('../components/Product.vue'),
      },
      {
        path: 'productDetail',
        name: 'ProductDetail',
        component: () => import('../components/ProductDetail.vue'),
      },
      {
        path: 'cart',
        name: 'Cart',
        component: () => import('../components/Cart.vue'),
      },
      {
        path: 'bills',
        name: 'Bills',
        component: () => import('../components/Bills.vue'),
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
